<!-- -->
<template>
  <div id='moneylist'>
    <div class="tradetop">{{headertitle}}</div>
    <!-- 注册币跳转页面 -->
    <div class="zhuce" v-if="zhuce">
        <div class="message">
            <ul>
                <li>转出账号：&emsp;<input type="text" v-model="name" placeholder="请输入会员名" maxlength='8'>&emsp;* 转出时请认真核对对方账户，确定无错误。</li>
                <li>转出数量：&emsp;<input type="text" v-model="number" placeholder="请输入数量"></li>
                <li>安全密码：&emsp;<input type="password" v-model="password" placeholder="请输入安全密码"></li>
            </ul>
        </div>
        <div class="btn">
            <button @click="verification1">确认转出</button>
            <router-link tag="a" :to="{name: 'registercoin'}"><button class="button2">取消</button></router-link>
        </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "moneylist",
  data() {
    return {
      status: this.$route.query.status,
      headertitle: "",
      zhuce: false,
      huigou: false,

      name: "",
      number: "",
      password: "",
      sumprice: "12313",
      price: "12"
    };
  },
  mounted: function() {
    console.log(this.status);
    // this.zhuce = true;
    if (this.status == "0") {
      this.headertitle = "注册币";
      this.zhuce = true;
    } else if (this.status == "1") {
      this.headertitle = "回购钱包";
      this.huigou = true;
    }
  },
  methods: {
    verification1() {
      if (!this.name) {
        this.$message({ message: "用户名不能为空", type: "error" });
      } else if (!this.number) {
        this.$message({ message: "数量不能为空", type: "error" });
      } else if (!this.password) {
        this.$message({ message: "安全密码不能为空", type: "error" });
      } else {
        this.axios
          .post("User/reg_zc_cl", {
            name: this.name,
            num: this.number,
            password: this.password
          })
          .then(({ data }) => {
            console.log(data);
            if (data.status == "5") {
              (this.name = ""),
                (this.num = ""),
                (this.password = ""),
                this.$message({ message: "操作成功", type: "success" });
            } else if (data.status === "1") {
              this.$message({ message: "密码不对", type: "error" });
            } else if (data.status === "2") {
              this.$message({ message: "数量不足", type: "error" });
            } else if (data.status === "3") {
              this.$message({ message: "没有这个用户", type: "error" });
            } else if (data.status === "4") {
              this.$message({ message: "不是一个团队，操作失败",type: "error"});
            } else if (data.status === "6") {
              this.$message({ message: "操作失败", type: "error" });
            }
          })
          .catch(function(error) {
            console.log(error);
          });
      }
    },
  }
};
</script>
<style lang='scss' scoped>
#moneylist {
  .tradetop {
    width: 100%;
    height: 55px;
    line-height: 65px;
    font-size: 13px;
    font-family: MicrosoftYaHei-Bold;
    color: rgba(0, 0, 0, 1);
    font-weight: 700;
    padding-left: 25px;
    box-sizing: border-box;
    border-bottom: 1px solid rgba(153, 153, 153, 1);
  }
  .zhuce {
    .warning {
      width: 550px;
      margin-top: 15px;
      margin-left: 25px;
      margin-bottom: 30px;
      padding-left: 5px;
      font-size: 11px;
      font-family: MicrosoftYaHei;
      color: rgba(0, 0, 0, 1);
      background: rgba(255, 247, 230, 1);
      border-radius: 2px;
      line-height: 31px;
      border: 1px solid rgba(224, 3, 0, 1);
    }
    .message {
      margin-left: 40px;
      margin-top: 10px;
      li {
        line-height: 50px;
        font-size: 12px;
        font-family: MicrosoftYaHei;
        color: rgba(102, 102, 102, 1);
        span {
          font-weight: 700;
        }
      }
      input {
        width: 209px;
        height: 33px;
        padding-left: 5px;
        border-radius: 2px;
        border: 1px solid rgba(151, 151, 151, 1);
      }
    }
    .btn {
      margin-top: 50px;
      margin-left: 40px;
      button {
        cursor: pointer;
        width: 82px;
        height: 33px;
        margin-left: 25px;
        background: rgba(224, 3, 0, 1);
        font-size: 12px;
        font-family: MicrosoftYaHei;
        color: rgba(255, 255, 255, 1);
        border-radius: 2px;
      }
      .button2 {
        background: rgba(225, 225, 225, 1);
        color: rgba(0, 0, 0, 1);
      }
      p {
        font-size: 11px;
        font-family: MicrosoftYaHei;
        color: rgba(102, 102, 102, 1);
        line-height: 30px;
      }
    }
  }
}
</style>